<template>
  <div :style="styleColor" ref="cesium"></div>
</template>

<script>
export default {
  name: "WidgetCesium",
  components: {},
  props: {
    value: Object,
    ispreview: Boolean,
  },
  data() {
    return {
      options: {},
      cid: 0,
    };
  },
  computed: {
    transStyle() {
      return this.objToOne(this.options);
    },
    styleColor() {
      return {
        position: this.ispreview ? "absolute" : "static",
        width: this.transStyle.width + "px",
        height: this.transStyle.height + "px",
        left: this.transStyle.left + "px",
        top: this.transStyle.top + "px",
        right: this.transStyle.right + "px",
      };
    },
  },
  watch: {
    value: {
      handler(val) {
        this.options = val;
      },
      deep: true,
    },
  },
  mounted() {

    this.options = this.value;

    //初始化三维地图
    setTimeout(() => {
      window.webGis = new SmartEarth.SGWorld(
        this.$refs.cesium,
        Cesium,
        {},
        null,
        function () {}
      );
    }, 100);
  },
  methods: {},
};
</script>

<style scoped lang="scss">
</style>
